home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
071-080
/
amok74
/
coords
/
coords.mod
< prev
next >
Wrap
Text File
|
1993-11-04
|
3KB
|
104 lines
(* -------------------------------------------------------------------------
:Program. Coords
:Contents. shows the position of the mouse
:Author. Holger Bolay
:Address. Hoffmannstraße 168
:Address. D-7250 Leonberg 1
:History. v1.0 Holger 21-Mar-92
:Copyright. Public Domain
:Language. Oberon
:Translator. AMIGA OBERON v2.42d
------------------------------------------------------------------------- *)
MODULE Coords;
IMPORT y: SYSTEM,
ol: OberonLib,
g: Graphics,
d: Dos,
e: Exec,
I: Intuition,
u: Utility,
so: StringOps;
VAR mywin: I.WindowPtr;
nw: I.NewWindow;
title: ARRAY 40 OF CHAR;
tmp: ARRAY 5 OF CHAR;
msg: I.IntuiMessagePtr;
time: d.Date;
gad: I.GadgetPtr;
type: SET;
Depth: INTEGER;
CONST SysSet = y.VAL (SET, I.sysGadget);
CloseSet = y.VAL (SET, I.close) + SysSet;
wUpSet = y.VAL (SET, I.wUpFront) + SysSet;
wDownSet = y.VAL (SET, I.wDownBack) + SysSet;
TitleTemplate = "x: 0000 y: 0000\o$VER: Coords 1.0 (21-Mar-92)\n\r";
PROCEDURE OverWriteInt(li: LONGINT; l, p: INTEGER; z: BOOLEAN);
BEGIN
so.IntToStr(li, tmp);
IF z THEN
so.LeftInsertZeroes(tmp, l);
ELSE
so.RightAdjust(tmp, l);
END; (* IF *)
so.OverWrite(title, tmp, p);
END OverWriteInt;
BEGIN
IF d.dos.lib.version<37 THEN HALT(20) END;
mywin := I.OpenWindowTagsA(NIL,
I.waLeft, 0,
I.waTop, 0,
I.waWidth, 1,
I.waHeight, 1,
I.waIDCMP, y.VAL(LONGINT, LONGSET{I.closeWindow}),
I.waCloseGadget, I.LTRUE,
I.waDepthGadget, I.LTRUE,
I.waDragBar, I.LTRUE,
I.waSimpleRefresh, I.LTRUE,
I.waNoCareRefresh, I.LTRUE,
I.waRMBTrap, I.LTRUE,
u.done);
IF mywin = NIL THEN HALT(20) END;
nw.height := mywin^.wScreen.barHeight;
title := TitleTemplate;
nw.width := g.TextLength(y.ADR(mywin^.wScreen^.rastPort),
title, 17);
gad := mywin^.firstGadget;
Depth := 0;
WHILE gad#NIL DO
type := y.VAL (SET, gad^.gadgetType);
IF (type*CloseSet = CloseSet) OR (type*wUpSet = wUpSet) OR
(type*wDownSet = wDownSet) THEN
INC(nw.width, gad.width);
END;
IF (type*wUpSet = wUpSet) OR (type*wDownSet = wDownSet) THEN
INC(Depth, gad.width);
END;
gad := gad^.nextGadget;
END;
I.MoveWindow(mywin, mywin^.wScreen^.width-Depth-nw.width, 0);
I.SizeWindow(mywin, nw.width, nw.height);
LOOP
d.Delay(5);
OverWriteInt(mywin^.mouseX+mywin^.leftEdge, 4, 3, TRUE);
OverWriteInt(mywin^.mouseY+mywin^.topEdge, 4, 12, TRUE);
I.SetWindowTitles(mywin, y.ADR(title), -1);
msg := e.GetMsg(mywin^.userPort);
IF msg#NIL THEN
IF I.closeWindow IN msg^.class THEN
e.ReplyMsg(msg);
EXIT;
END;
e.ReplyMsg(msg);
END;
END; (* LOOP *)
CLOSE
IF mywin#NIL THEN I.CloseWindow(mywin); mywin := NIL END;
END Coords.